﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Cloud.Model;
using Cloud.BLL;
using System.Configuration;

public partial class Three_Managerment_Problem_three_Department : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            if (!IsPostBack)
            {

            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }
    public void bind1()
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString);
            SqlCommand cmd = new SqlCommand("select DW.DWMC ,ISNULL((SELECT COUNT (id) FROM Problem where zrdwid=DW.DWBH and DW.DWLB=3 and handle_type = 0 ), 0 )  AS dbsj" + "ISNULL((SELECT COUNT (id) FROM Problem where handle_type = 1 and zbtime='1900-01-01 00:00:00' and '2016-10-18' < xbtime), 0 ) AS yblsj from DW order by dbsj desc" + "ISNULL((SELECT COUNT (id) FROM Problem where handle_type = 2 and zbtime='1900-01-01 00:00:00' and '2016-10-18' < xbtime), 0 ) AS yblsj from DW order by dbsj desc" + "ISNULL((SELECT COUNT (id) FROM Problem where handle_type = 3 and zbtime='1900-01-01 00:00:00' and '2016-10-18' < xbtime), 0 ) AS yblsj from DW order by dbsj desc", connection);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            repeater.DataSource = ds.Tables["problem"];
            repeater.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }
    protected void Unnamed_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            this.bind1();
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }
    protected void repeater_ItemDataBound1(object sender, RepeaterItemEventArgs e)
    {

    }
}